package com.tuhu.dai.domain.order.model.aggregate;

import com.tuhu.dai.domain.order.model.entity.OrderEntity;
import com.tuhu.dai.domain.order.model.entity.ProductEntity;
import com.tuhu.dai.domain.order.model.valobj.OrderStatusVO;
import lombok.*;
import org.apache.commons.lang3.RandomStringUtils;

import java.util.Date;

/**
 * @author: DaiTao
 * @description:
 * @create: 2025-08-31 20:43
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CreateOrderAggregate {

    private String userId;

    private ProductEntity payProduct;

    private OrderEntity orderEntity;

    public static OrderEntity buiderOrderEntity(String productId, String productName) {
        return OrderEntity.builder()
                .productId(productId)
                .productName(productName)
                .orderId(RandomStringUtils.randomNumeric(14))
                .orderTime(new Date())
                .orderStatusVO(OrderStatusVO.CREATE)
                .build();
    }


}
